#!/bin/bash

set -e

echo ""
echo "-------------------------------------------------------------------------------"
echo "-- Removing directory ./veins-runall-output/*.out -----------------------------"
echo "-------------------------------------------------------------------------------"
rm -f veins-runall-output/*.out
echo ""
echo "-------------------------------------------------------------------------------"
echo "-- Running tests and collecting results ---------------------------------------"
echo "-------------------------------------------------------------------------------"
opp_runall ./run -d -- -c General -u Cmdenv "$@"
echo ""
echo "-------------------------------------------------------------------------------"
echo "-- Passed tests ---------------------------------------------------------------"
echo "-------------------------------------------------------------------------------"
cat veins-runall-output/*.out | egrep "^\[asserts-INFO\]" || echo "none."
echo ""
echo "-------------------------------------------------------------------------------"
echo "-- Failed tests----------------------------------------------------------------"
echo "-------------------------------------------------------------------------------"
cat veins-runall-output/*.out | egrep "^\[asserts-ERROR\]" && exit 1 || echo "none."
echo ""
